package com.situ.allaia.controller;

import com.situ.allaia.interceptor.LoginInterceptor;
import com.situ.allaia.model.AdminUser;
import jakarta.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Map;


@Controller
public class IndexController {

    @RequestMapping({"/", "/index"})
    public String index(HttpSession session, Map<String,Object> map) {
        AdminUser user = (AdminUser) session.getAttribute(LoginInterceptor.CURRENT_ADMIN_LOGIN_USER_KEY);
        map.put("user",user);
        return "index";
    }

    @GetMapping("/sub_index")
    public String subIndex() {
        return "welcome-2";
    }
}
